import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

public class BMPUtil {
	
	public static final int ChanelR = 0;
	public static final int ChanelG = 1;
	public static final int ChanelB = 2;

	public static BufferedImage convertFromImage(Image img) {

		BufferedImage buffImage = new BufferedImage(img.getWidth(null),
				img.getHeight(null), BufferedImage.TYPE_INT_RGB);
		Graphics2D g = buffImage.createGraphics();
		g.drawImage(img, 0, 0, null);
		g.dispose();
		return buffImage;

	}
	
	public static int getRGBInt(int r, int g, int b) {
		int ret = 0xff;
		ret = (ret << 8) | r;
		ret = (ret << 8) | g;
		ret = (ret << 8) | b;
		return (ret);
	}
	
//	public static int getRGBInt(int r, int g, int b, int chanel) {
//		int ret = 0xff;
//		if(chanel == ChanelR) {
//			g = 0;
//			b = 0;
//		}
//		else if (chanel == )
//	}
}
